package com.bckj.freshnow.order.trade.fsm;

import com.alibaba.cola.statemachine.Action;
import com.bckj.freshnow.order.trade.fsm.enums.TradeBillEventEnum;
import com.bckj.freshnow.order.trade.fsm.enums.TradeBillStatusEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class TradeBillAction implements Action<TradeBillStatusEnum, TradeBillEventEnum, TradeBillContext> {

    @Override
    public void execute(TradeBillStatusEnum from, TradeBillStatusEnum to, TradeBillEventEnum event, TradeBillContext ctx) {
        switch (event) {
            case ALL_PAY_SUCCESS -> {
                log.info("全部账单流水已支付 billId={}", ctx.getBillId());

            }
            case ORDER_CANCEL -> {
                log.info("订单取消 billId={}", ctx.getBillId());

            }
        }
    }
}
